<%--
  @desc: 应用列表首页
  @author: chenw
  @create: 2014-4-29 下午 15:32
--%>
<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="/WEB-INF/taglib/econsole" prefix="econsole" %>
<div class="pageHeader">
    <form rel="pageForm" onsubmit="return navTabSearch(this);" action="<c:url value='/log/messageloglist'/>"
          method="get">
        <div class="searchBar">
            <ul>
                <li style="float: left;line-height: 25px;">
                    <label style="width:60px;">标题名称：</label>
                    <input name="keywords" type="text" value="${query.keywords}" placeholder="请输入标题名称进行检索"
                           style="width:250px;font-family:'微软雅黑 sans-serif serif';"/>
                </li>
                <li style="float: left;line-height: 25px;">
                    <label style="width:60px;">发送时间：</label>
                    <input name="start" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss"
                           value="<fmt:formatDate value="${query.start}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                           placeholder="起始时间"
                           style="width:100px;font-family:'微软雅黑 sans-serif serif';"/>
                    -
                    <input name="end" type="text" class="date" dateFmt="yyyy-MM-dd HH:mm:ss"
                           value="<fmt:formatDate value="${query.end}" pattern="yyyy-MM-dd HH:mm:ss"/>"
                           placeholder="结束时间"
                           style="width:100px;font-family:'微软雅黑 sans-serif serif';"/>
                </li>
                <li style="float: left;line-height: 25px;">
                  <label>消息类型：</label> <select name="content_number">
                    <option value="" selected="selected">全部</option>
                    <option value="-2" <c:if test="${query.content_number==-2}">selected="selected"</c:if>>升级信息</option>
                    <option value="2" <c:if test="${query.content_number==2}">selected="selected"</c:if>>公示公告</option>
                    <option value="1" <c:if test="${query.content_number==1}">selected="selected"</c:if>>办件过程</option>
                    <option value="-1" <c:if test="${query.content_number==-1}">selected="selected"</c:if>>系统通知</option>
                    <option value="-3" <c:if test="${query.content_number==-3}">selected="selected"</c:if>>新闻通知</option>
            
                    
                    
                </select>
                </li>
                <li style="float: left;line-height: 25px;">
                  <label>推送对象：</label> <select name="receiver">
                    <option value="" selected="selected">全部</option>
                    <option value="1" <c:if test="${query.receiver==1}">selected="selected"</c:if>>广播</option>
                    <option value="2" <c:if test="${query.receiver==2}">selected="selected"</c:if>>群组</option>
                    <option value="3" <c:if test="${query.receiver==3}">selected="selected"</c:if>>单发</option>
                </select>
                </li>
                <li style="float: left;line-height: 25px;">
                    <div class="buttonActive" style="margin-left: 5px;">
                        <div class="buttonContent">
                            <button type="submit">查找</button>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </form>
</div>
<div class="pageContent" style="padding-top: 1px;">
    <div class="panelBar">
        <ul class="toolBar">
            <li><a href="<c:url value='/log/viewMsgContent/{sel_id}'/>" target="dialog" class="add" rel="page_app_add"
                   mask="true" resizable="false"
                   maxable="false" title="查看明细" width="400"><span>查看</span></a></li>
            <li class="line">line</li>
        </ul>
    </div>
    <table class="table" width="100%" layoutH="114">
        <thead>
        <tr>
            <th width="40" align="center">序号</th>
            <th width="50">消息类型</th>
            <th width="50">标题</th>
            <th width="100">推送对象</th>
            <th width="100">发送时间</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="msg" items="${pager.list}" varStatus="vs">
            <tr target="sel_id" rel="${msg.id}">
                <td width="40">${vs.count+(pager.pageNum-1)*pager.numPerPage}</td>
                <td width="50" class="msgContent"><span style="display: none">${msg.msg_content}</span></td>
                <td width="50" class="msgContent2"><span style="display: none">${msg.msg_content}</span></td>
                <td width="100"><econsole:selectValue code="2000" value="${msg.receiver_type}"/></td>
                <td width="100"><fmt:formatDate value="${msg.create_time}" pattern="yyyy-MM-dd HH:mm"/></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
    <div class="panelBar">
        <div class="pages">
            <span>显示&nbsp;</span>
            <select id="cob_ps" class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">
                <option value="20">20</option>
                <option value="50">50</option>
                <option value="100">100</option>
                <option value="200">200</option>
            </select>
            <span>条，共${pager.total}条</span>
        </div>
        <div class="pagination" targetType="navTab" totalCount="${pager.total}" numPerPage="${pager.numPerPage}"
             pageNumShown="10"
             currentPage="${pager.pageNum}"></div>
    </div>
    <form id="pagerForm" method="post" action="<c:url value='/log/messageloglist'/>">
        <input type="hidden" name="pageNum" value="${pager.pageNum}"/> 
        <input type="hidden" name="content_number" value="${query.content_number}"/>
        <input type="hidden" name="receiver" value="${query.receiver}"/>
        <input type="hidden" name="numPerPage" value="${pager.numPerPage}"/>
        <input type="hidden" name="status" value="${pager.status}">
        <input type="hidden" name="keywords" value="${query.keywords}"/>
        <input type="hidden" name="start"
               value="<fmt:formatDate value="${query.start}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
        <input type="hidden" name="end" value="<fmt:formatDate value="${query.end}" pattern="yyyy-MM-dd HH:mm:ss"/>"/>
        <input type="hidden" name="orderDirection" value="${query.orderDirection}"/>
    </form>
</div>
<script>
    $(function () {
        $(".msgContent span").each(function () {
            var dataObj = eval("(" + $(this).html() + ")");
            $(this).parent().html(getTypeStr(dataObj.content_type));
        });
        
        $(".msgContent2 span").each(function () {
            var dataObj = eval("(" + $(this).html() + ")");
            $(this).parent().html(dataObj.title);
        });
    });

    function getTypeStr(type) {
        switch (type) {
            case 1:
                return "办件过程";
            case 2:
                return "公示公告";
            case -1:
                return "系统通知";
            case -2:
                return "升级信息";
            case -3:
                return "新闻通知";
            default :
                return "未知类型：" + type;
        }
    }
</script>